<?php


namespace app\cms\community\thirdPartyApi\abstracts;


use iflow\Response;

abstract class Pay
{
    // 支付订单参数
    protected mixed $payConfig;

    // 创建订单后的参数
    protected mixed $result = [];

    // 支付类型
    protected array $payType = [];

    // 错误信息
    protected string $error = '';

    /**
     * 创建订单
     * @param string $type | 支付类型 QR/JSAPI/H5/WAP
     * @return bool|Response
     */
    abstract public function createOrder(string $type): bool|Response;

    /**
     * 创建JSAPI接口数据
     * @return Response
     */
    abstract public function JsApiPay(): Response;

    /**
     * 创建支付二维码
     * @return Response
     */
    abstract public function QrApiPay(): Response;

    /**
     * H5 支付方式
     * @return Response
     */
    abstract public function H5ApiPay(): Response;

    /**
     * @return array
     */
    public function getResult(): array
    {
        return $this->result;
    }
}